/*
 * Copyright 2022 The Open Islands Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.openislands.oi.config.stateengine;

import org.openislands.oi.constant.StateRuleEnum;

public class StateTransition {
    private final StateRuleEnum stateRuleEnum;
    private final String currentState;
    private final String targetState;

    public StateTransition(StateRuleEnum stateRuleEnum, String currentState, String targetState) {
        this.stateRuleEnum = stateRuleEnum;
        this.currentState = currentState;
        this.targetState = targetState;
    }

    public StateRuleEnum getStateRuleEnum() {
        return stateRuleEnum;
    }

    public String getCurrentState() {
        return currentState;
    }

    public String getTargetState() {
        return targetState;
    }

    public static class Job extends StateTransition {
        public Job(String currentState, String targetState) {
            super(StateRuleEnum.JOB, currentState, targetState);
        }

        public static StateTransition create(String currentState, String targetState) {
            return new Job(currentState, targetState);
        }
    }

    public static class Task extends StateTransition {
        public Task(String currentState, String targetState) {
            super(StateRuleEnum.TASK, currentState, targetState);
        }

        public static StateTransition create(String currentState, String targetState) {
            return new Task(currentState, targetState);
        }
    }
}
